import { Comment, Tooltip, List } from "antd";
import React, { useEffect, useState } from "react";
import Http from '../../http'
import { RouteComponentProps, useParams } from "react-router-dom";

// interface PropsType {
//   data: {
//     author: string;
//     avatar: string;
//     content: string;
//     createDate: string;
//   }[];
// }

interface MatchParams {
  touristRouteId: string;
}

export const ProductComments: React.FC<RouteComponentProps<MatchParams>> = ({id}) => {
  const [pageNum, setPageNum] = useState(0);
  const [pageSize, setPageSize] = useState(5);

  console.log('id', id)

  let fetch = async () => {
    const data = await Http({
      url: '/comment/lists',
      body: {
        id,
        pageSize: pageSize,
        pageNum: pageNum
      }
    });
    setPageNum(pageNum => pageNum + 1)
    console.log(data)
  }

  useEffect(() => {
    fetch()
  }, []);

  return (
    // <List
    //   dataSource={data}
    //   itemLayout="horizontal"
    //   renderItem={(item) => {
    //     return (
    //       <li>
    //         <Comment
    //           author={item.author}
    //           avatar={item.avatar}
    //           content={item.content}
    //           datetime={item.createDate}
    //         />
    //       </li>
    //     );
    //   }}
    // ></List>
    <></>
  );
};
